package com.techvision.ip2regionproject.controller;

import com.techvision.ip2regionproject.dto.IpRegionDTO;
import com.techvision.ip2regionproject.service.Ip2RegionService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class IpController {
    @Resource
    private Ip2RegionService ip2RegionService;

    @GetMapping("/ip-info")
    public IpRegionDTO getIpInfo(@RequestParam String ip) {
        return ip2RegionService.searchParseDto(ip);
    }
}